var Events = {
  listens: {},
  on: function (eventName, cb) {
    if (this.listens[eventName]) {
      this.listens[eventName].push(cb);
    } else {
      this.listens[eventName] = [cb];
    }
  },
  trigger: function (eventname) {
    for (let i = 0; i < this.listens[eventname].length; i++) {
      this.listens[eventname][i].call();
    }
  }
}


Events.on('loginsuccess', () => {
  console.log('login success')
})


Events.trigger('loginsuccess')
Events.trigger('loginsuccess')